package com.pw.study.actors

import akka.actor.{Actor, ActorRef}

/**
 * @Desc: TODO
 * @author: future
 * @since: 2022/5/22-9:47
 */
class AActor(actor: ActorRef) extends Actor {
  private val actorB: ActorRef = actor
  private var count = 0

  override def receive: Receive = {
    case "start" => {
      println("AACtor 启动了。。。。")
      println("start ok...")
      println("我打")
      actorB ! "我打"
    }
    case "我打" => {
      count += 1
      println(s"AA黄飞虎 你很强，看我猴子偷桃，第${count}招")
      Thread.sleep(1000)
      actorB!"我打"

    }
  }
}
